package cn.acac.yygh.hosp.controller.admin;

import cn.acac.yygh.hosp.service.DepartmentService;
import cn.acac.yygh.model.hosp.Department;
import cn.acac.yygh.result.R;
import cn.acac.yygh.vo.hosp.DepartmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;


    /**
     * 根据医院的id查询医院底下所有的科室信息
     * @param hoscode
     * @return
     */
    @GetMapping("/{hoscode}")
    public R getDepartmentList(@PathVariable(value = "hoscode")String hoscode){
        List<DepartmentVo> departmentVoList = departmentService.getDepartmentList(hoscode);
        return R.ok().setData("list",departmentVoList);
    }
}
